<template>
  <div class="loading-container" @click.stop.prevent>
    <div class="flex-row-xy-center">
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
    </div>
    <div class="tip-text">{{ title }}</div>
  </div>
</template>

<script setup>
import {ref} from "vue";

const title = ref(""); // 加载提示文字
// 更改加载提示文字
const setTitle = (val) => {
  title.value = val;
};

// 暴露出去
defineExpose({
  title,
  setTitle
});
</script>

<style lang="less" scoped>
.loading-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: rgba(255, 255, 255, 0.6);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;

  .tip-text {
    color: #3793ff;
    margin-top: 10px;
  }

  .dot {
    width: 18px;
    height: 18px;
    border-radius: 100%;
    animation: slide 1.5s infinite;
  }

  .dot:nth-child(1) {
    animation-delay: 0.1s;
    background: #1fbfff;
  }

  .dot:nth-child(2) {
    animation-delay: 0.2s;
    background: #2ea4ff;
  }

  .dot:nth-child(3) {
    animation-delay: 0.3s;
    background: #3793ff;
  }

  .dot:nth-child(4) {
    animation-delay: 0.4s;
    background: #3b89ff;
  }

  .dot:nth-child(5) {
    animation-delay: 0.5s;
    background: #4577ff;
  }
}

@-moz-keyframes slide {
  0% {
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(2);
  }
  100% {
    transform: scale(1);
  }
}

@-webkit-keyframes slide {
  0% {
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(2);
  }
  100% {
    transform: scale(1);
  }
}

@-o-keyframes slide {
  0% {
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(2);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes slide {
  0% {
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(2);
  }
  100% {
    transform: scale(1);
  }
}
</style>
